package com.ie.controller;

import com.ie.common.http.Result;
import com.ie.entity.Like;
import com.ie.service.LikeService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/system/like")
public class LikeController {
    @Resource
    private LikeService likeService;
    //点赞

    @GetMapping("/likes")
    public boolean likeCommunity(@RequestParam("id") String userid, @RequestParam("likeid") String likeid)
    {
        System.err.println("userid:"+userid+"likeid:"+likeid);
        Like like=  likeService.likeCommunity(userid, likeid);
        if (like!=null) {
            return true;
        }
        return false;

    }
    //查询
    @GetMapping("/find")
    public Result findLike(@RequestParam("userid") String userid)
    {
        return   likeService.findLike(userid);

    }
    //转发
    @GetMapping("/zhuanfa")
    public void jia(@RequestParam("cid") String cid)
    {
        likeService.jia(cid);
    }
}
